package com.freak.wanandroid.base.repository;


import com.freak.httpmanager.AbstractRepository;
import com.freak.httpmanager.HttpMethods;
import com.freak.httpmanager.event.LiveBus;
import com.freak.wanandroid.app.ApiService;


/**
 * 数据中转仓库
 *
 * @author Freak
 * @date 2022/09/12.
 */
public class BaseRepository extends AbstractRepository {
    protected ApiService mApiService;

    public BaseRepository() {
        mApiService = HttpMethods.getInstance().create(ApiService.class);
    }

    protected void postData(Object eventKey, Object t) {
        postData(eventKey, null, t);
    }

    protected void showPageState(Object eventKey, String state) {
        postData(eventKey, state);
    }

    protected void showPageState(Object eventKey, String tag, String state) {
        postData(eventKey, tag, state);
    }

    protected void postData(Object eventKey, String tag, Object t) {
        LiveBus.getDefault().postEvent(eventKey, tag, t);
    }
}
